<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.util.*, com.yaodian100.crm.workorder.entity.WorkOrder, com.yaodian100.core.common.utils.JspUtil"
    %>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%
String woId=request.getParameter("id");
List<WorkOrder> results=new ArrayList<WorkOrder>();
while(woId!=null){
    //WorkOrder wo=(WorkOrder)JspUtil.get("com.yaodian100.crm.workorder.entity.WorkOrder", Long.parseLong(woId));
    Object[] resultsIn=JspUtil.queryByHql("from WorkOrder where parent.id=?", new Object[]{Long.parseLong(woId)}, null);
    woId=null;
    if(resultsIn!=null)
    for(Object obj:resultsIn){
		results.add((WorkOrder)obj);
		woId=String.valueOf(((WorkOrder)obj).getId());
    }
}
request.setAttribute("results", results);
%> 

<table class="tb-1" width="100%">
		<thead>
			<tr>
				
				<th>ID</th>
				<th>状态</th>
				<th>类型</th>
				<th>短描述</th>
				<th>前单备注</th>
				<th>注解</th>
				<th>处理人</th>
				<th>处理群组</th>
				<th>审核群组</th>
				<th>审核状态</th>
				<th>建立日期</th>
				
			</tr>
		</thead>
		<tbody>
			<c-rt:forEach items="${results}" var="result" varStatus="rows_index">
			<c-rt:set var="domain" value="${pu:get('com.yaodian100.crm.cs.entity.Question', result.domainId)}"/>
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					
					<td>${result.id }</td>
					<td>${pu:menuOption('WorkOrder.status', pu:toString(result.status)).name }</td>
					<td>
					<c-rt:if test="${domain.type.name=='CommonQuestion' }">
						<c-rt:if test="${domain.extraValue['isProductQAA'].value=='true' }">
							商品问答
						</c-rt:if>
						<c-rt:if test="${domain.extraValue['isProductQAA'].value!='true' }">
							客服问答
						</c-rt:if>
					</c-rt:if>
					<c-rt:if test="${domain.type.name!='CommonQuestion' }">
					${domain.type.description }
					</c-rt:if>
					</td>
					<td>${result.shortDesc }</td>
					<td>${result.comment}</td>
					<td>${result.note}</td>
					<td>
					
					${result.owner.username }
					
					</td>
					<td>
					<c-rt:if test="${!empty result.node.responseGroup}">
					${pu:get('com.yaodian100.core.admin.entity.Group', result.node.responseGroup).description }(${result.node.responseGroup })
					</c-rt:if>
					</td>
					<td>
					<c-rt:if test="${!empty result.node.approveGroup}">
					${pu:get('com.yaodian100.core.admin.entity.Group', result.node.approveGroup).description }(${result.node.approveGroup })
					</c-rt:if>
					</td>
					<td>
					<c-rt:if test="${result.approveStatus==0 }">
					待审核
					</c-rt:if>
					<c-rt:if test="${result.approveStatus==1 }">
					已核可
					</c-rt:if>
					<c-rt:if test="${result.approveStatus==2 }">
					已注销
					</c-rt:if>
					</td>
					<td><fmt-rt:formatDate value="${result.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				</tr>
			</c-rt:forEach>
		</tbody>
	</table>
